var mongodb = require('./mongodb');


var Schema = mongodb.mongoose.Schema;
var ObjectId = Schema.ObjectId;

var WordSchema = new Schema({
    name: {type: 'String', required: true},
    cid: {type: ObjectId, required: true},
    explain: {type: 'String', required: true},
    
    readNumber: {type: 'Number', default: 0}, //阅读次数
    rightNumber: {type: 'Number', default: 0},//正确回答次数
    wrongNumber: {type: 'Number', default: 0},//错误回答次数

    createTime: { type: Date, default: Date.now},
    modifyTime: {type: Date, default: Date.now},
    status: {type: 'Number', default: 0, required: true, min: 0, max: 1}
}, {
    collection: "words"
});


module.exports =  mongodb.mongoose.model("Word", WordSchema);

